<%-- 
    Document   : friends
    Created on : 9 févr. 2013, 11:00:12
    Author     : gabrielle
--%>

<%@page import="models.LineFriends"%>
<%@page import="models.Users"%>
<%@page import="models.Friends"%>
<%@page import="models.Messenger"%>
<%@page import="java.util.ArrayList"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <%@include file="WEB-INF/jspf/head.jspf"%>   
    <body>
        <%@include file="WEB-INF/jspf/header.jspf"%>
        <div class="page">
            <div class="content">
                <p><a href="./messages">Wall</a>
                <a href="./logout">Logout</a>
                </p>
                <p>
                <form action="./friends" method="post">
                    Add a friend:
                    <input type="text" name="username">
                    <input type="submit" value="Submit" name="submit">
                </form></p>
                
                <% 
                    request.getSession(true).setAttribute("type", "wall");
                    
                    ArrayList<LineFriends> allFriends=new ArrayList();
                    allFriends = (ArrayList) request.getSession().getAttribute("friends");
                    for (LineFriends friend : allFriends)
                    {
                        %><p><%out.println(friend.getUser().getUsername());%></p><%
                    }

                  
                    
                   /* if(request.getSession().getAttribute("search")!=null)
                    {
                        Users user=(Users)request.getSession().getAttribute("friend");
                        if(user!=null)
                        {
                         %><!--<form action="./friends" method="post">
                           <input type="text" name="username">
                                    <%out.println(user.getUsername());%></input>
                            %>
                            
                                <input type="submit" value="Add as a friend">
                            </form>-->
                            <%
                        }
                        else
                        {
                            out.println("Username not found");
                        }
                                               
                    }*/
                %>
                
            </div>
        </div>
                <%@include file="WEB-INF/jspf/footer.jspf" %>
    </body>
</html>
